'''

双链表的每个节点有两个指针:一个张志祥后一个节点,另一个指向前一个节点
如何建立双链表?

双链表节点的插入
p.next = curnode.next
curnode.next.prior = p
p.prior = curnode
curnode.next = p

双链表节点的删除
p = curnode.next
curnode.next = curnode.next.next/p.next
curnode.next.next.prior = curnode
del p

'''
class Node:
    def __init__(self,item):
        self.item = item
        self.next = None
        self.prior = None

def creat_doublelinklist(li):
    head = li[0]
    tail = head
    for element in li[1:]:
        node = Node(element)
        tail.next = node
        node.prior = tail
        tail = node